package com.biqee.util;

public class CamelNameTransferUtil {
	private static final char ESCAPE_TOKEN = '_';
	
	/**
	 * change aaa_bbb_ccc tobe aaaBbbCcc
	 * @param inputName
	 * @return
	 */
	public static String getPropertyName(String inputName) {
		if(inputName == null) {
			return null;
		} 
		
		if(inputName.indexOf(ESCAPE_TOKEN) == -1) {
			return inputName;
		}
		
		StringBuffer sb = new StringBuffer();
		boolean needChange = false;
		for(int i = 0; i < inputName.length(); i++) {
			char ch = inputName.charAt(i); 
			if(ch == ESCAPE_TOKEN) {
				needChange = true;
				continue;
			}
			
			if(needChange) {
				sb.append(("" + ch).toUpperCase());
				needChange = false;
			} else {
				sb.append(ch);
			}
		}
		
		return sb.toString();
	}
}
